package com.atguigu.day05.HomeWork;

/**
 * @version 1.0
 * @Author 马冰
 * @Date 2024/11/4 20:23
 * @注释 大透乐 ,前区35选5,后区12选2,生成随机数
 */
public class HomeWork7 {
    public static void main(String[] args) {
        int[] front = new int[35];
        int[] after = new int[12];
        for (int i = 0; i < 5; i++) {
            int a = (int)(Math.random() * front.length);
            if (front[a] == 0) {
                front[a] = 1;
            }else{
                front[(int)(Math.random()*front.length)] = 1;
            }

        }
        for (int i = 0; i < 2; i++) {
            int b = (int)(Math.random() * after.length);
            if (after[b] == 0) {
                after[b] = 1;
            }else{
                after[(int)(Math.random()*after.length)] = 1;
            }

        }
        System.out.print("前五位数字是:");
        for(int i = 0; i < front.length; i++) {
            if(front[i] == 1) {
                System.out.print((i + 1) + " ");
            }
        }
        System.out.println();
        System.out.print("后两位数字是:");
        for(int i = 0; i < after.length; i++) {
            if(after[i] == 1) {
                System.out.print((i + 1) + " ");
            }
        }
        System.out.println();

    }
}
